import request from '/@/utils/request'
export const prefix = 'system'

/**
 * 获取文件夹数据
 */
export function getFolder(id) {
    return request({
        url: prefix + '/sysEnterpriseFolder/getFolder?id='+id,
        method: 'get',
    })
}

/**
 * 获取企业空间余额
 */
export function getEnterpriseInfo() {
    return request({
        url: prefix + '/sysEnterprise/getInfo',
        method: 'get',
    })
}

/**
 * 更新文件夹名称
 */
export function updateFolderName(id,name) {
    return request({
        url: prefix + '/sysEnterpriseFolder/update?id='+id+'&name='+name,
        method: 'get',
    })
}

/**
 * 创建文件夹
 */
export function createFolder(data) {
    return request({
        url: prefix + '/sysEnterpriseFolder/create',
        method: 'post',
        data
    })
}

/**
 * 文件批量移动
 */
export function batchMove(data) {
    return request({
        url: prefix + '/sysEnterpriseFolder/batchMove',
        method: 'post',
        data
    })
}

/**
 * 鼠标悬停文件夹
 */
export function hoverFolder(id) {
    return request({
        url: prefix + '/sysEnterpriseFolder/hoverFolder/'+id,
        method: 'get',
    })
}

/**
 * 删除文件夹
 */
export function removeFolder(id) {
    return request({
        url: prefix + '/sysEnterpriseFolder/remove/'+id,
        method: 'get',
    })
}


/**
 * 上传文件列表
 */
export function pageList(data) {
    return request({
        url: prefix + '/sysUserFileLog/pageList',
        method: 'post',
        data
    })
}

/**
 * 删除上传的文件
 */
export function removeFile(id) {
    return request({
        url: prefix + '/sysUserFileLog/remove/'+id,
        method: 'get',
    })
}

/**
 * 文件上传
 */
export function upload(data) {
    return request({
        url:'/file/filaAttach/upload',
        method: 'post',
        headers:{'Content-Type':'multipart/form-data'},
        data
    })
}


/**
 * 文件下载
 */
export function download(data) {
    return request({
        url:'/file/filaAttach/downAllFile',
        method: 'post',
        headers:{
            'Content-Type': 'application/json; application/octet-stream'
        },
        responseType:'blob',
        data
    })
}
